home *** CD-ROM | disk | FTP | other *** search
- // copyright 1993 Michael B. Johnson; some portions copyright 1994, MIT
- // see COPYRIGHT for reuse legalities
- //
-
- #import <appkit/appkit.h>
- #import <3Dkit/3Dkit.h>
- #import "WW3DCamera.h"
- #import "WW3DAttributeState.h"
-
- @protocol WWRenderable
-
- // this method should be implemented as - class { return [super class]; }
- // I have to declare it because otherwise the compiler whines at me...
- - class;
-
- // this is a bit of a cheat, here, but the doc is a bit stupid. If you have
- // objects *that are a component part of you* (like, say, you're a compound
- // command and you've got a bunch of renderable commands inside of you), you
- // need to make unique copies of those objects. In other words, if you would
- // free it when you got free'ed, then you should make a unique copy of it.
- - copyFromZone:(NXZone *)zone;
-
- // If the object pushes or pops the current transformation matrix, this
- // method returns YES. If the object does this in a balanced way internally,
- // i.e. it pushes the ctm twice and then pops it twice, it should return NO.
- // The degenerate case of that is if the object doesn't pop or push it all.
- // Examples of current WW3DKit objects that do return YES would be RIBAttributeBegin,
- // RIBAttributeEnd, RIBSolidBegin, RIBSolidEnd, RIBTransformBegin, RIBTransformEnd
- - (BOOL)pushesOrPopsCTM;
- // these two methods should also be implemented
- - (BOOL)pushesCTM; // RIBAttributeBegin, RIBTransformBegin, RIBSolidBegin
- - (BOOL)popsCTM; // RIBAttributeEnd, RIBTransformEnd, RIBSolidEnd
-
-
- // If the object occupies some volume of space, this should return YES.
- // If it returns NO, the following three methods probably won't be called,
- // but they should be implemented reasonably just to be safe.
- - (BOOL)hasBoundingBox;
-
- // this is the accessor that should be used by other objects that wish
- // to inquire about this object's bounding box. It needs to guarantee
- // that value it is returning is currently valid.
- // note that is a change over the old time independent method, which was
- // too dangerous to keep around
- - (RtBound *)boundingBoxStartingAt:(RtFloat)intervalStartTime endingAt:(RtFloat)intervalEndTime;
-
- // this calculates the maximum extent this object occupies over the duration specified
- // this should also be private, or maybe even go away from public scrutinty...
- - calculateBoundingBoxStartingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
-
- // this is a private method, should only used by an instance on itself
- - setBoundingBox:(RtBound *)newBoundingBox;
-
- - renderMaps:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime usingStream:(NXStream *)ns;
- - renderMaps:(WW3DCamera *)camera usingStream:(NXStream *)ns;
- - renderMaps:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
- - renderMaps:(WW3DCamera *)camera;
- - renderSelfAsBox:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
- - renderSelf:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
- - renderSelf:(WW3DCamera *)camera;
- - preRenderSelf:(WW3DCamera *)camera startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
- - preRenderSelf:(WW3DCamera *)camera;
-
- // note this is changed from the 2.0 method; sending RtMatrix over the wire is just a bad idea (and it also couldn't contain enough info)
- - transformCTM:(WW3DAttributeState *)attributeState startingAt:(RtFloat)shutterOpenTime endingAt:(RtFloat)shutterCloseTime;
-
- - (BOOL)isMotionBlurrable;
- - (BOOL)isCompoundCommand;
- // if you're not an animatable command, return 0.0 (although it won't be used...)
- - (float)lastSampleIsAt;
-
- // by implementing this method, you're guaranteeing that you can return a
- // linear interpolated version of yourself and "b". You should check to
- // make sure that "b" responds to the appropriate methods. Also, "uValue"
- // is supposed to be between 0 and 1, although if you want to deal with
- // values out of that range, knock yourself out...
- // also note that even if b is totally bogus, you should at least return self
- - (BOOL)isLerpable;
- - lerpWith:b by:(float)uValue; // this method may return self, b, or a new copy
- - lerpSelfWith:b by:(float)uValue; // this method may return self or b
-
- // this method returns the number of bytes of bandwidth that this
- // command would consume over the wire. If unsure, err on the larger
- // side. This methods is merely for communication bandwidth
- // visualization, so don't be overly concerned about it...
- - (unsigned long int)maxSampleBandwidth;
-
- - writeEve:(NXStream *)stream atTabLevel:(int)tab;
- // unless you're an animatable command, writeScene:atTabLevel is exactly the same as writeEve:atTabLevel:
- - writeScene:(NXStream *)stream atTabLevel:(int)tab;
- - write3DTextScene:(NXStream *)stream atTabLevel:(int)tab index:(int)index time:(float)time until:(float)lastTime;
- - writeInventorAtTime:(float)currentTime to:(NXStream *)stream atTabLevel:(int)tab;
-
- // this method will be sent to allow an instance to compare itself
- // against another instance. This is really a housekeeping command to
- // help generate the most concise RIB file possible. This method is
- // usually called when building up a (set of) MotionBegin/End block(s),
- // so if a command responds NO to this, then a MotionBegin/End block will
- // be written, otherwise just the first command will be. If you're
- // unsure, return NO. You'll have a fatter RIB file, but hey...
- - (BOOL)theSameAs:otherRIBCommand;
-
- // similarTo: is much weaker than "theSameAs:", and is used mainly to
- // differentiate the various polygon and patch commands from each other
- // in MotionBegin/End blocks
- - (BOOL)similarTo:otherRIBCommand;
-
- // if this particular instance is moot, like a RIBSphere with a radius of 0, or a cylinder with zMin == zMax, etc., then
- // this should return YES, otherwise no. This is really a housekeeping command to help generate the most concise RIB file
- // possible. If you're unsure, return NO
- - (BOOL)isMoot;
- - (BOOL)isMootStartingAt:(float)startTime endingAt:(float)endTime;
-
- // please note that while objects that conform to this protocol have
- // to implement the various startingAt:endingAt: routines, they're not
- // expected to do anything different than their shorter named
- // corresponding routines. It's only objects that conform to the
- // WWAnimatable protocol are really expected to do anything weird (i.e. motion blur) there.
- // The same goes for the lastSampleAt method; unless a command is animatable,
- // it has no notion of extent or position with respect to time; only animatable commands do.
-
- @end
-